🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / map / src / commonTest / kotlin / org / meshtastic / feature / map / component / WaypointExpiryTest.kt
Displaying Raw • Download
feature/map/src/commonTest/kotlin/org/meshtastic/feature/map/component/WaypointExpiryTest.kt renovate/fastlane-2.x-lockfile (056eed64) Text, 1.97 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.map.component
Tff7b72import T7ee787kotlin.test.Test
Tff7b72import T7ee787kotlin.test.assertEquals
Tff7b72import T7ee787kotlin.test.assertFalse
Tff7b72import T7ee787kotlin.test.assertTrue
Tff7b72import T7ee787kotlin.time.Clock
T8b949e/**
* The two sentinels the `expire` wire field carries instead of being nullable.
*
* The editor reads them in four places, and each used to spell the check out itself.
*/
Tff7b72class T56d364WaypointExpiryTest Tb4b4b4{
Tf0883e@Test
Tff7b72fun Td2a8ff`neither sentinel counts as an expiry`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3assertFalseTb4b4b4(T79c0ff0.Te6edf3isExpirySetTb4b4b4(Tb4b4b4)Tb4b4b4, Ta5d6ff"Ta5d6ff0 means no expiry was ever setTa5d6ff"Tb4b4b4)
Te6edf3assertFalseTb4b4b4(Tffa657IntTb4b4b4.Te6edf3MAX_VALUETb4b4b4.Te6edf3isExpirySetTb4b4b4(Tb4b4b4)Tb4b4b4, Ta5d6ff"Ta5d6ffInt.MAX_VALUE means never expiresTa5d6ff"Tb4b4b4)
Tb4b4b4}
Tf0883e@Test
Tff7b72fun Td2a8ff`a real timestamp counts as an expiry`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Te6edf3assertTrueTb4b4b4(T79c0ff1Te6edf3_800_000_000Tb4b4b4.Te6edf3isExpirySetTb4b4b4(Tb4b4b4)Tb4b4b4)
Tb4b4b4}
Tf0883e@Test
Tff7b72fun Td2a8ff`a set expiry is returned as itself`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3seconds Tff7b72= T79c0ff1Te6edf3_800_000_000
Te6edf3assertEqualsTb4b4b4(Te6edf3secondsTb4b4b4.Te6edf3toLongTb4b4b4(Tb4b4b4)Tb4b4b4, Te6edf3secondsTb4b4b4.Te6edf3expiryInstantOrDefaultTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3epochSecondsTb4b4b4)
Tb4b4b4}
Tf0883e@Test
Tff7b72fun Td2a8ff`both sentinels fall back to the same default ahead of now`Tb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3now Tff7b72= Te6edf3ClockTb4b4b4.Te6edf3SystemTb4b4b4.Te6edf3nowTb4b4b4(Tb4b4b4)
Te6edf3listOfTb4b4b4(T79c0ff0Tb4b4b4, Tffa657IntTb4b4b4.Te6edf3MAX_VALUETb4b4b4)Tb4b4b4.Te6edf3forEach Tb4b4b4{ Te6edf3sentinel Tff7b72-Tff7b72>
Tff7b72val Te6edf3fallback Tff7b72= Te6edf3sentinelTb4b4b4.Te6edf3expiryInstantOrDefaultTb4b4b4(Tb4b4b4)
Te6edf3assertTrueTb4b4b4(Te6edf3fallback Tff7b72> Te6edf3nowTb4b4b4, Ta5d6ff"Tffd700$Te6edf3sentinelTa5d6ff should seed an expiry in the future, got Tffd700$Te6edf3fallbackTa5d6ff"Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tb4b4b4}
Served by rngit 1.5.2 - Generated in 0.14s